//this file define a tester interface for test frame
//andycai.sc@gmail.com 2012-04-19

#ifndef GFRAMETESTER_H_INCLUDED
#define GFRAMETESTER_H_INCLUDED

#include <string>
#include <vector>
#include <iostream>
#include "GTpl/GMap.h"

using std::string;
using std::vector;
using std::cout;
using std::endl;

class GFrameTester
{
public:
	virtual ~GFrameTester() {}

	const string& getTestName() { return m_testName; }

	virtual void run() = 0;

protected:
	GFrameTester(const string& testName) : m_testName(testName)
	{
	}
	string m_testName;
};

class GFrameTestRunner
{
public:
	GFrameTestRunner(int argc, char** argv);
	~GFrameTestRunner();

	bool parseArgs();

	void addTester(GFrameTester*);

	void runTest();

private:
	void help();
	void run(GFrameTester* tester);

	GMap<string, GFrameTester*> *m_testers;
	vector<string> m_args;
	vector<GFrameTester*> m_runalbeTesters;
	bool m_isAll;
	vector<string> m_unknownTests;
};

#endif // GFRAMETESTER_H_INCLUDED
